﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using LiveCharts.Wpf;
using LiveCharts;

namespace QuickStart_Project_01.Chart
{
    /// <summary>
    /// PieChart.xaml 的交互逻辑
    /// </summary>
    public partial class PieChartView : UserControl
    {
        public SeriesCollection PieSeriesCollection { get; set; }

        public PieChartView()
        {
            InitializeComponent();
            PieSeriesCollection = new SeriesCollection
            {
                new PieSeries
                {
                    Title = "苹果",
                    Values = new ChartValues<double> { 8 },
                    DataLabels = true,
                    Fill = Brushes.Red
                },
                new PieSeries
                {
                    Title = "香蕉",
                    Values = new ChartValues<double> { 6 },
                    DataLabels = true,
                    Fill = Brushes.Yellow
                },
                new PieSeries
                {
                    Title = "橙子",
                    Values = new ChartValues<double> { 10 },
                    DataLabels = true,
                    Fill = Brushes.Orange
                },
                new PieSeries
                {
                    Title = "橘子",
                    Values = new ChartValues<double> { 21 },
                    DataLabels = true,
                    Fill = Brushes.Gold
                },
                new PieSeries
                {
                    Title = "西瓜",
                    Values = new ChartValues<double> { 30 },
                    DataLabels = true,
                    Fill = Brushes.DarkRed
                }
            };

            this.DataContext = this;
        }
    }
}
